import store from './store';

// test
export const getToken = state => {
  if (state.token) {
    return state.token;
  } else {
    store.commit('set_token', sessionStorage.getItem('token'));
    return sessionStorage.getItem('token');
  }
};
export const getUsername = state => {
  if (state.username) {
    return state.username;
  } else {
    store.commit('set_username', sessionStorage.getItem('username'));
    return sessionStorage.getItem('username');
  }
};
export const getImgURL = state => {
  return state.imgDomain;
};
export const getUserInfo = state => {
  if (state.userInfo) {
    return state.userInfo;
  } else {
    store.commit('set_userInfo', sessionStorage.getItem('userInfo'));
    return sessionStorage.getItem('userInfo');
  }
};
